<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<c:set var="extLibs" value="grid"/>
<sys:header title="会员管理" extLibs="${extLibs}" />
<div class="portlet box ${boxStyleColor}">
	<div class="portlet-title">
		<div class="caption"><i class="fa fa-coffee"></i> 总工会审核</div>
		<div class="actions">
			<a href="#" class="btn btn-default btn-sm" id="btnSearch" title="查询"><i class="fa fa-search"></i> 查询</a>
		</div>
	</div>
	<div class="portlet-body list">
		<form:form id="searchForm" modelAttribute="member" action="${ctx}/mdm/member/approveData2" method="post" class="breadcrumb form-inline hide"
				data-page-no="${page.pageNo}" data-page-size="${page.pageSize}" data-order-by="${page.orderBy}">
			<div class="form-group">
				<label class="control-label">姓名：</label>
				<div class="input-inline">
					<form:input path="name" htmlEscape="false" maxlength="64" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">性别：</label>
				<div class="input-inline">
					<form:input path="sex" htmlEscape="false" maxlength="1" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">生日：</label>
				<div class="input-inline">
					<input name="birthday" type="text" readonly="readonly" maxlength="20" class="form-control input-sm Wdate width-90"
						value="<fmt:formatDate value="${member.birthday}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">审批状态：</label>
				<div class="input-inline">
					<form:select path="approveStatus" multiple="false" class="form-control "  >
						<form:option value="2">待审批</form:option>
						<form:option value="9">全部</form:option>
						<form:option value="4">通过</form:option>
						<form:option value="5">退回</form:option>
					</form:select>
				</div>
			</div>
			<div class="form-group" style="margin-left:10px;"> 
				<input class="btn btn-primary btn-sm" type="submit" value="查询"/>&nbsp;
				<input class="btn default btn-sm" type="reset" value="重置"/>
			</div>
		</form:form>
		<table id="dataGrid"></table>
	    <div id="dataGridPage"></div>
	</div>
</div>
<sys:footer extLibs="${extLibs}" />
<script type="text/javascript">
	// 初始化DataGrid对象
	$("#dataGrid").dataGrid({
		
		searchForm: $("#searchForm"), // 数据来源表单
		tabPageId: '${param.tabPageId}',// 当前页签编号
		
		// 设置数据表格列
		columnModel: [
			{header:'姓名', name:'name', index:'a.name', width:200, align:"left", frozen:true, formatter: function(val, obj, row, act){
				return '<a href="${ctx}/mdm/member/form?id='+row.id+'" class="btnList" data-title="编辑会员">'+(val ? val : row.id)+'</a>';
			}},
			{header:'性别', name:'sex', index:'a.sex', width:50, fixed:true, align:"center", formatter: function(val, obj, row, act){
				return getDictLabel(${fns:getDictListJson('sex')}, val, '未知', true);
			}},
			{header:'生日', name:'birthday', index:'a.birthday', width:120, align:"center"},
			{header:'文化程度', name:'culturalLevel', index:'a.cultural_level', width:120, align:"center",formatter: function(val, obj, row, act){
				return getDictLabel(${fns:getDictListJson('education')}, val, '未知', true);
			}},
			{header:'党派', name:'partisan', index:'a.partisan', width:200, align:"left"},
			{header:'参加工作时间', name:'workDate', index:'a.work_date', width:200, align:"left"},
			{header:'籍贯', name:'nativePlace', index:'a.native_place', width:200, align:"left"},
			{header:'家庭住址', name:'address', index:'a.address', width:200, align:"left"},
			{header:'备注信息', name:'remarks', index:'a.remarks', width:200, align:"left"},
			{header:'更新时间', name:'updateDate', index:'a.update_date', width:200, align:"left"},
			{header:'操作', name:'actions', width:100, fixed:true, sortable:false, formatter: function(val, obj, row, act){
				var actions = [];//<shiro:hasPermission name="mdm:member:edit">
				if (row.status == Global.STATUS_NORMAL){
				}//</shiro:hasPermission>
				actions.push('<a href="${ctx}/mdm/member/approveForm2?id='+row.id+'" class="btnList" title="会员审核"><i class="fa fa-pencil"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/proposal/approveLog/memberApprovelist?id='+row.id+'" class="btnList" title="流程跟踪"><i class="fa fa-bullseye"></i></a>&nbsp;');
				return actions.join('');
			}}
		],
		ajaxSuccess: function(data){ // 加载成功后执行方法
			
		}
	});
	
	//导出
	$("#btnExport").click(function(){
		top.$.jBox.confirm("确认要导出数据吗？","系统提示",function(v,h,f){			
			if(v=="ok"){
				ajaxDownload('${ctx}/mdm/member/export',$("#searchForm").serialize());
			}
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	});
	
	//文件下载
	function ajaxDownload(url, data, method) {
		console.log(data);
		// 获取url和data
		if (url && data) {		
			// data 是 string 或者 array/object
			data = typeof data == 'string' ? data : jQuery.param(data);
			// 把参数组装成 form的 input
			var inputs = '';		
			
			$.each(data.split('&'), function() {
				var pair = this.split('=');
				inputs += '<input type="hidden" name="' + pair[0] + '" value="'
						+ pair[1].replace('+','') + '" />';
			});
			// request发送请求
			$('<form action="' + url + '" method="' + (method || 'post')
					+ '" >' + inputs + '</form>').appendTo('body').submit().remove();
		}
	}
</script>